package com.quanyan.place.component;

import cn.bailingniao.api.mq.SportsMqTopic;
import com.quanyan.place.constants.PlaceConstants;
import com.quanyan.mq.mq.producer.AbstractMqProducer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * Created by zhaohui on 2017/5/23.
 */
@Component
public class MqSportProducer extends AbstractMqProducer {

    @Value("${mq.nameServer.address}")
    private String nameServerAddress;

    @Override
    protected String getProducerGroup() {
        return SportsMqTopic.GROUP;
    }

    @Override
    protected String getNameServerAddress() {
        return this.nameServerAddress;
    }

    @Override
    protected String getInstanceName() {
        return PlaceConstants.PLACE_INSTANCE_PRODUCER;
    }

    @PostConstruct
    void run() {
        super.start();
    }
}
